package task

import (
	"fmt"
	"github.com/robfig/cron/v3"
	"time"
)

var Scheduler *cron.Cron

func InitScheduler() {

	Scheduler = cron.New(cron.WithSeconds())
	Scheduler.AddFunc("*/10 * * * * *", func() {
		fmt.Println("[TASK] 每10秒执行一次：", time.Now().Format("15:04:05"))
	})

	Scheduler.Start()
	fmt.Println("✅ 定时任务调度器启动成功")
}
